<!-- 列表 -->
<extend name="Public:layout" />
<block name="title"><{$authName}></block>

<block name="pluginCSS">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2-metronic.css"/>
</block>
<block name="CSS"></block>

<block name="loadJS">

<script type="text/javascript" src="__PUBLIC__/Admin/plugins/select2/select2.min.js"></script>
<script src="__PUBLIC__/admin/scripts/layer/layer.js" type="text/javascript"></script>	
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/raty/jquery.raty.min.js"></script>

</block>
<block name="setJS">
<script>
var ajaxUrl="<{:U('index')}>";
function edit(){
	   var params = {};

	   params.id = $('#id').val();
	   params.isShow = document.getElementById('isShow1').checked?1:0;
	   params.goodsScore = $('.goodsScore > input[name="score"]').val();
	   if(params.goodsScore==0){
	   	layer.msg('请选择商品评分!',{icon:0,time:2000});
		   return;
	   }
		
	   params.timeScore = $('.timeScore > input[name="score"]').val();
	   if(params.timeScore==0){
		  layer.msg('请选择时效评分!',{icon:0,time:2000});
		   return;
	   }
		
	   params.serviceScore = $('.serviceScore > input[name="score"]').val();
	   if(params.serviceScore==0){
		   layer.msg('请选择服务评分!',{icon:0,time:2000});
		   return;
	   }
		
	   params.content = $.trim($('#content').val());
	   if(params.content.length<3 || content.length>80){
		   layer.msg('请输入评价内容',{icon:0,time:2000});
		   return;
	   }
	   params.ajax = "edit";
	   $.post("<{:U('index')}>",params,function(data){
		    
			if(data){
				layer.msg('评价修改成功!',{icon:1,time:2000});				
				location.href='<{:U("index")}>';

			}else{
				layer.msg('评价修改失败!',{icon:0,time:2000});
				return;
			}
	  });
}

$(function () {
	   var options = {
				hints         : ['很不满意', '不满意', '一般', '满意', '非常满意'],
				width:200,
				targetKeep: true,
				starHalf:'__PUBLIC__/Admin/plugins/raty/img/star-half-big.png',
				starOff:'__PUBLIC__/Admin/plugins/raty/img/star-off-big.png',
				starOn:'__PUBLIC__/Admin/plugins/raty/img/star-on-big.png',
				cancelOff: '__PUBLIC__/Admin/plugins/raty/img/cancel-off-big.png',
			    cancelOn: '__PUBLIC__/Admin/plugins/raty/img/cancel-on-big.png'
	    }
	  options.target='#goodsScore_hint';
	  options.score='<{$object['goodsScore']}>';
	  $('.goodsScore').raty(options);
	  options.target='#timeScore_hint';
	  options.score='<{$object['timeScore']}>';
	  $('.timeScore').raty(options);
	  options.target='#serviceScore_hint';
	  options.score='<{$object['serviceScore']}>';
	  $('.serviceScore').raty(options);
	  $('.form-horizontal button.gp').click(function(e){
	  	e.preventDefault();
	  	edit();
	  });	   
   }); 
</script>
</block>
<block name="initJS">
</block>

<block name="pagetitle">增删改查</block>
<block name="page">

<div class="row">
	<div class="col-md-12">
		<div class="portlet">
			<div class="portlet-title">
				<div class="caption">
					<i class="fa <{$authIco}>"></i><{$authName}>
				</div>
				
				<div class="actions">
					<a class="btn default green-stripe" id="table_manager_new" data-toggle="modal" href="javascript:history.back()">
						<i class="fa fa-reply"></i>
						<span class="hidden-480">返回</span>
					</a>
				</div>
				
			</div>
			<div class="portlet-body">
				
				<form class="form-horizontal" method="post">
				<input type='hidden' id='id' value="<{$object['id']}>"/>
				
		          <div class="form-group">
					<label class="col-sm-2 control-label">商品：</label>
					<div class="col-md-6"><p class="form-control-static"><img src='__UPLOAD__/<{$object['goodsImg']?$object['goodsImg']:$COMMON.goodsImage}>' width='50'/>&nbsp;<{$object['goodsName']}></p>
					</div>
				</div>

					<div class="form-group">
						<label class="col-sm-2 control-label">所属订单：</label>
						<div class="col-md-6"><p class="form-control-static"><{$object['orderNo']}></p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">用户：</label>
						<div class="col-md-6"><p class="form-control-static"><{$object['loginName']}></p>
						</div>
					</div>
		           <div class="form-group">
						<label class="col-sm-2 control-label">评价：</label>
						<div class="col-md-6"><div style='width:500px;'>
		                <div style='float:left;width:70px;'>商品评分：</div>
		                <div style='float:left;width:430px;'>
		                <div class="goodsScore"  style='float:left'></div>
						<div id="goodsScore_hint"  style='float:left'></div>
						</div>
					 </div>
					 <div style='width:500px;'>
		                <div style='float:left;width:70px;'> 时效评分：</div>
		                <div style='float:left;width:430px;'>
		                <div class="timeScore"  style='float:left'></div>
						<div id="timeScore_hint" style='float:left'></div>
						</div>
					 </div>
					 <div style='width:500px;'>
		                <div style='float:left;width:70px;'>服务评分：</div>
		                <div style='float:left;width:430px;'>
		                <div class="serviceScore"  style='float:left'></div>
						<div id="serviceScore_hint"  style='float:left'></div>
						</div>
					 </div>
						</div>
					</div>
		             <div class="form-group">
						<label class="col-sm-2 control-label" for="isShow">状态：</label>
						<div class="col-md-6">
						<div class="radio-list">
					    <label class="radio-inline">
						<input type='radio' id='isShow1' name='isShow' value='1' <if condition="$object['isShow'] == 1 ">checked</if>/> 显示 </label>
					     <label class="radio-inline"> 
		             <input type='radio' id='isShow0' name='isShow' value='0' <if condition="$object['isShow'] == 0 ">checked</if>/> 隐藏  </label>
					                    </div>
						</div>
					</div>
		           <div class="form-group">
						<label class="col-sm-2 control-label" for="content">评语：</label>
						<div class="col-md-6">
						<textarea id='content' name='content' row="3" class="form-control"><{$object['content']}></textarea>
						</div>
					</div>
		           <div class="form-group fluid">
		                <div class="col-md-offset-2 col-md-9">
		                  <button type="submit" class="gp btn blue" >保存</button>
		                  <button type="reset" class="btn default">取消</button>
		                </div>
		              </div>
		          </form>           
			</div>
		</div>
	</div>
</div>
</block>